#!/bin/bash
source /etc/profile
. $BEETLE_SHELL_PATH/error.sh

tail_log(){
    tail -fn100 $1 || error_exit
}

logdir=/usr/beetle/applogs

case "$1" in
    api)
        tail_log /usr/beetle/applogs/beetle/beetle.log ;;
    plan)
        tail_log /usr/beetle/applogs/beetle-plan/beetle-plan.log ;;
    uc)
        tail_log /usr/beetle/applogs/ucloud-master/ucloud-master.log ;;
    auth)
        tail_log /usr/beetle/applogs/beetle-auth/beetle-auth.log ;;
    uConfig)
        tail_log /usr/beetle/applogs/uConfig/uConfig.log ;;
    *)
    	# echo "Usage: tail-log {api|auth|plan|uc|uConfig}"
        tail_log ${logdir}/$1/$1.log
    exit 1
esac
exit 0